﻿using System.ComponentModel.DataAnnotations.Schema;

namespace CuongHanh.Models
{
    [Table("tbl_OrderDetailForGem")]
    public class OrderDetailForGem
    {
        public OrderDetailForGem() { }

        public OrderDetailForGem(OrderDetailForGem model)
        {
            OrderForGemId = model.OrderForGemId;
            ParentStyleId = model.ParentStyleId;
            ParentMaterialId = model.ParentMaterialId;
            ParentStoneId = model.ParentStoneId;
            ChildStyleId = model.ChildStyleId;
            ChildStoneId = model.ChildStoneId;
            ChildMaterialId = model.ChildMaterialId;
            ParentPriceOfMaterial = model.ParentPriceOfMaterial;
            ParentPriceOfStone = model.ParentPriceOfStone;
            ChildPriceOfMaterial = model.ChildPriceOfMaterial;
            ChildPriceOfStone = model.ChildPriceOfStone;
            DefaultSize = model.DefaultSize;
            ParentSize = model.ParentSize;
            PriceOfDifferentSize = model.PriceOfDifferentSize;
            Count = model.Count;
        }

        public int Id { get; set; }

        public int StyleTypeId { get; set; }

        public int OrderForGemId { get; set; }

        public int ParentStyleId { get; set; }

        public int ParentMaterialId { get; set; }

        public int ParentStoneId { get; set; }

        public int ChildStyleId { get; set; }

        public int ChildStoneId { get; set; }

        public int ChildMaterialId { get; set; }

        public long ParentPriceOfMaterial { get; set; }

        public long ParentPriceOfStone { get; set; }

        public long ChildPriceOfMaterial { get; set; }

        public long ChildPriceOfStone { get; set; }

        public int DefaultSize { get; set; }

        public int ParentSize { get; set; }

        public long PriceOfDifferentSize { get; set; }

        public int Count { get; set; }

        public long GetPrice
        {
            get
            {
                return (ParentPriceOfMaterial +(PriceOfDifferentSize*(ParentSize - DefaultSize)) + ParentPriceOfStone + ChildPriceOfMaterial + ChildPriceOfStone);
            }
        }
        public long GetTotalPrice
        {
            get
            {
                return (ParentPriceOfMaterial + (PriceOfDifferentSize * (ParentSize - DefaultSize)) + ParentPriceOfStone + ChildPriceOfMaterial + ChildPriceOfStone) * Count;
            }
        }
    }
}
